package com.example.demo.aspector;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * 工具相关接口切面
 */
@Aspect
@Component
public class ToolsAspector {

    @Pointcut("execution (* com.example.demo.controller.client.ToolsController.*(..))")
    public void handle() {

    }

    @Before("handle()")
    public void beforeAdvice() {
//        System.out.println("beforeAdvice...");
    }

    @After("handle()")
    public void afterAdvice() {
//        System.out.println("afterAdvice...");
    }

    @Around("handle()")
    public Object aroundAdvice(ProceedingJoinPoint proceedingJoinPoint) {
//        System.out.println("before");
        try {
            return proceedingJoinPoint.proceed();
        } catch (Throwable t) {
            t.printStackTrace();
        }
//        System.out.println("after");
        return null;
    }
}
